import request from "@/request/index.js";

// 获取分组维度
export function getGroupDimensions(queryType) {
	return request({
		url: `/data-query/group-dimensions`,
		method: 'get',
		params: { queryType }
	});
}

// 获取可用输出字段
export function getOutputFields(queryType) {
	return request({
		url: `/data-query/output-fields`,
		method: 'get',
		params: { queryType }
	});
}

// 校验查询条件
export function validateConditions(data) {
	return request({
		url: `/data-query/validate`,
		method: 'post',
		data
	});
}

// 汇总查询
export function summaryQuery(data) {
	return request({
		url: `/data-query/summary`,
		method: 'post',
		data
	});
}

// 汇总下钻
export function summaryDrillDown(data, drillDownPath) {
	return request({
		url: `/data-query/summary/drill-down`,
		method: 'post',
		params: { drillDownPath },
		data
	});
}

// 数据查询（处理表）
export function dataQuery(data) {
	return request({
		url: `/data-query/data`,
		method: 'post',
		data
	});
}

// 原始数据查询
export function rawDataQuery(data) {
	return request({
		url: `/data-query/raw-data`,
		method: 'post',
		data
	});
}

// 导出
export function exportQuery(data, exportType) {
	return request({
		url: `/data-query/export`,
		method: 'post',
		params: { exportType },
		data,
		responseType: 'blob',
		headers: {
			'Content-Type': 'application/json'
		}
	});
}
